package com.qianli.cashmama.trade.common.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/7/21
 * Time: 上午11:40
 */
public enum TradeTypeEnum {
    INNER(0, "内部订单"),
    DERATING(1, "降级通过的订单"),
    DIRECT(2, "CASHMAMA导流(自动创建新订单状态待提现)"),
    THIRD(3, "open_api直接审核通过订单");

    private int type;
    private String desc;

    TradeTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public TradeTypeEnum setType(int type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public TradeTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static TradeTypeEnum conventByType(int type) {
        TradeTypeEnum tradeTypeEnum = null;
        for (TradeTypeEnum typeEnum : TradeTypeEnum.values()) {
            if (typeEnum.getType() == type) {
                tradeTypeEnum = typeEnum;
                break;
            }
        }
        return tradeTypeEnum;
    }
}
